#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

from lib2to3.pgen2 import token
import os
import numpy as np

gt="bash_gt.rsf"
# inc="all_include.rsf"
# inc="true_include.rsf"
# inc="cmg_all_sym_inc.rsf"
# inc="cmg_true_sym_inc.rsf"
# inc="bash_inc_dep.rsf"
inc="bash_sym_dep.rsf"
# inc="dep_deredundancy_yacc.rsf"
# inc="cmg_sym.rsf"
# inc = "cmg_own_sym.rsf"

gt_files=set()
with open(gt,'r') as f:
    lines=f.readlines()
    for line in lines:
        line=line.split()
        gt_files.add(line[2])
# print(gt_files)

inc_files=set()
with open(inc,'r') as f:
    lines=f.readlines()
    for line in lines:
        line=line.split()
        inc_files.add(line[1])
        inc_files.add(line[2])

intersections=gt_files.intersection(inc_files)
print("intersection size: ",len(intersections))

print(f"{gt} size: ",len(gt_files))
print(f"{inc} size: ",len(inc_files))

diff_1 = inc_files.difference(gt_files)
print(f"{len(diff_1)} files in {inc} are not in {gt}: ")
print("\t",diff_1)
# for file in diff_1:
#     if file in gt_files:
#         print(file)
diff_2 = gt_files.difference(inc_files)
print(f"{len(diff_2)} files in {gt} are not in {inc}: ")
print("\t",diff_2)
# for file in diff_2:
#     if file in gt_files:
#         print(file)

# for line in lines:
#     tokens=line.split()
#     if tokens[1] in diff or tokens[2] in diff:
#         print(line,)
#         continue